<?php use_helper('Date'); ?>
<?php $prj_id = $sf_user->getAttribute('prj_id', -1) ?>

<h1>Calendrier</h1>
<h2>Entrées répétables</h2>

<table class="liste">
	<tr>
		<th/>
		<th>Date</th>
		<th>Heure</th>
		<th>Objet</th>
		<th>Fréquence</th>
		<th>Jour</th>
		<th>Active</th>
	</tr>
	<?php foreach ($planning_list as $planning): ?>
		<tr>
			<td><?php echo link_to(image_tag('edit'), 'calendrier/edit_planning?cal_id='.$planning->getCalplnId()) ?></td>
			<td><?php echo format_date($planning->getCalplnDate(), 'dd/MM/yyyy') ?></td>
			<td><?php echo format_date($planning->getCalplnHeureDebut(), 'HH:mm') .' - '. format_date($planning->getCalplnHeureFin(), 'HH:mm') ?></td>
			<td><?php echo $planning->getCalplnLibelle() ?></td>
			<td><?php echo Calendrier_PlanningTable::getFrequence($planning->getCalplnFreq()) ?></td>
			<td>
				<?php 
					switch ($planning->getCalplnFreq()) {
					case 'M':
						echo Calendrier_PlanningTable::getJourMois($planning->getCalplnJour());
						break;
					case 'S':
						echo Calendrier_PlanningTable::getJourSemaine($planning->getCalplnJour());
						break;
					}
				?>
			<td><?php echo $planning->getCalplnActif() ?></td>
		</tr>
	<?php endforeach; ?>
</table>
